package fr.mma.achievement.controller;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import fr.mma.achievement.model.persistence.Achievement;

public class AchievementUtils {

	static public Map<String, List<Achievement>> groupByDev(List<Achievement> achievementList) {
		Map<String,List<Achievement>> achievementGroup = new HashMap<String, List<Achievement>>();
		for (Achievement achievement : achievementList) {
			String devIdentifiant = achievement.getDeveloppeur().getName();
			if(!achievementGroup.containsKey(devIdentifiant)) {
				achievementGroup.put(devIdentifiant, new ArrayList<Achievement>());
			}
			achievementGroup.get(devIdentifiant).add(achievement);
		}
		return achievementGroup;
	}
}
